package com.example.administrator.nl.fragment.order;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.administrator.nl.R;
import com.example.administrator.nl.adapter.MyOrderAdapter;
import com.example.administrator.nl.bean.MyOrderBean;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * 我的订单
 */
public class MyOrderFragment extends Fragment {
    Unbinder mUnbinder;
    @BindView(R.id.recycler_view)
    RecyclerView recyclerView;

    public MyOrderFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_my_order, container, false);
        mUnbinder = ButterKnife.bind(this, view);
        init();
        return view;
    }

    private void init() {
        List<MyOrderBean> orderBeanList = new ArrayList<>();
        orderBeanList.add(new MyOrderBean());
        orderBeanList.add(new MyOrderBean());
        orderBeanList.add(new MyOrderBean());
        orderBeanList.add(new MyOrderBean());
        orderBeanList.add(new MyOrderBean());
        orderBeanList.add(new MyOrderBean());
        MyOrderAdapter adapter = new MyOrderAdapter(R.layout.item_my_order, orderBeanList);
        recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
        recyclerView.setAdapter(adapter);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        if (null != mUnbinder) {
            mUnbinder.unbind();
        }
    }
}
